package clases;
import java.awt.BorderLayout;





import java.awt.Canvas;
import java.awt.event.HierarchyBoundsAdapter;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JProgressBar;
import javax.swing.JTextArea;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;
import javax.swing.SwingUtilities;



/**
 * This code was edited or generated using CloudGarden's Jigloo
 * SWT/Swing GUI Builder, which is free for non-commercial
 * use. If Jigloo is being used commercially (ie, by a corporation,
 * company or business for any purpose whatever) then you
 * should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details.
 * Use of Jigloo implies acceptance of these licensing terms.
 * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
 * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
 * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class MainMetas extends javax.swing.JFrame {
	private Canvas canvasOpciones;
	private JButton btnEjemplo;
	private JFormattedTextField cajaTxt;
	private JButton bgn_Metas;
	private JButton btft_Metas;
	private JTextArea lbl_bienvenido;
	private TftMetas metast;
	private GngMetas metasg;

	/**
	 * Auto-generated main method to display this JFrame
	 */
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				MainMetas inst = new MainMetas("hola");
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}

	public MainMetas(String hola ) {
		super();
//		metast=null;
//		metasg=null;
		initGUI();
	}

	private void initGUI() {
		try {
			
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			this.setName("FrameMetas");
			getContentPane().setBackground(new java.awt.Color(191,191,191));
			this.setResizable(false);
			this.setFont(new java.awt.Font("Arial",0,10));
			this.setTitle("Planning Continuo - Metas");
			
			{
				lbl_bienvenido = new JTextArea();
				getContentPane().add(lbl_bienvenido);
				lbl_bienvenido.setText(" Módulo de Manejo \n      de Metas ");
				lbl_bienvenido.setBounds(206, 93, 217, 57);
				lbl_bienvenido.setBackground(new java.awt.Color(173,216,230));
				lbl_bienvenido.setFont(new java.awt.Font("Abyssinica SIL",1,20));
				lbl_bienvenido.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				lbl_bienvenido.setEditable(false);
				lbl_bienvenido.setVisible(false);
			}
			{
				btft_Metas = new JButton();
				getContentPane().add(btft_Metas);
				btft_Metas.setText("Transformación de Metas");
				btft_Metas.setBounds(31, 183, 261, 46);
				
				
				btft_Metas.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent evt) {
						if(btft_Metas.isEnabled())
						{ 
							btft_Metas.setEnabled(false);
							btft_MetasMouseClicked(evt);
						}
						else
						{ 
							metast.dispose();
							btft_Metas.setEnabled(true);
							
						}
				
					}
					
				});
			}
			{
				bgn_Metas = new JButton();
				getContentPane().add(bgn_Metas);
				bgn_Metas.setText("Manejo de Metas");
				bgn_Metas.setBounds(333, 183, 267, 46);

				bgn_Metas.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent evt) {
						bgn_Metas.setEnabled(false);
						bgn_MetasMouseClicked(evt);
					}
				});
			}
			{
				cajaTxt = new JFormattedTextField();
				getContentPane().add(cajaTxt);
				cajaTxt.setText("           Módulo de Manipulación de Metas\n");
				cajaTxt.setBounds(8, 12, 609, 57);
				cajaTxt.setDropMode(javax.swing.DropMode.USE_SELECTION);
				cajaTxt.setEditable(false);
				cajaTxt.setBackground(new java.awt.Color(173,216,230));
				cajaTxt.setFont(new java.awt.Font("Comic Sans MS",1,24));
			}
			{
				btnEjemplo = new JButton();
				getContentPane().add(btnEjemplo);
				btnEjemplo.setText("Invoca");
				btnEjemplo.setBounds(266, 288, 54, 22);
				btnEjemplo.addMouseListener(new MouseAdapter() {
					public void mouseClicked(MouseEvent evt) {
						btnEjemploMouseClicked(evt);
					}
				});
			}
			pack();
			this.setSize(629, 423);
		} catch (Exception e) {
			//add your error handling code here
			System.out.println("There is a exeption!");
			e.printStackTrace();
		}
	}

	private void btft_MetasMouseClicked(MouseEvent evt) {

		System.out.println("btft_Metas.mouseClicked, event="+evt);

		metast= new TftMetas();
		metast.setLocationRelativeTo(null);
		metast.setVisible(true);
		metast.setEnabled(true);

	}

	private void bgn_MetasMouseClicked(MouseEvent evt) {
		System.out.println("bgn_Metas.mouseClicked, event="+evt);
		metasg=new GngMetas();
		metasg.setLocationRelativeTo(null);
		metasg.setVisible(true);


	}
	
	private void btnEjemploMouseClicked(MouseEvent evt) {
		System.out.println("btnEjemplo.mouseClicked, event="+evt);
		
		
	}
}
